package com.wn.demo;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author yellow Docter
 * @date 2024 -06-13
 * @desc
 */
public class Demo01 {

    public static void main(String[] args) {


        List<Student> stus = new ArrayList<>();

        stus.add(new Student("zs",20));
        stus.add(new Student("ls",21));
        stus.add(new Student("ww",22));

        List<String> strings = new ArrayList<>();
        for (Student student : stus) {

        }

        //拿到流
        List<String> names = stus.stream() //拿到流
                .map(student -> student.getName())   //操作
                .collect(Collectors.toList());       //收集
        System.out.println("names = " + names);

        Student xxx = new Student("xxx", 20);

        System.out.println(xxx.getName());


    }

}
